import {
	ref
} from "vue";

export default function useComment(data, $http) {
	const list = ref([]);
	/*获取文章评论列表*/
	const {
		articleId
	} = data;
	const _getCommentList = async () => {
		try {
			const listArr = await $http.get_comments({
				articleId,
			});
			list.value = listArr;
		} catch (error) {
			console.error("获取评论列表失败", error);
			list.value = [];
		}
	};
	return {
		list,
		_getCommentList,
	};
}